package controller.admin.employee;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import model.DTO.EmployeeEditPasswordDTO;
import service.Impl.EmployeeServiceImpl;
import util.Encrypt;
import util.GetJsonUtil;
import util.ResultUtil;

import java.io.IOException;

@WebServlet("/admin/employee/editPassword")
public class EmployeeEditPasswordController extends HttpServlet {
    //员工修改密码
    @Override
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        EmployeeEditPasswordDTO e= (EmployeeEditPasswordDTO) GetJsonUtil.get(req,new EmployeeEditPasswordDTO());
        EmployeeServiceImpl service=new EmployeeServiceImpl();
        service.EditPassword(e.getEmpId(),e.getNewPassword(),e.getOldPassword());
        String json= ResultUtil.getJSON(null);
        resp.getWriter().write(json);

    }

}
